package com.evil.common.core.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FindByIdReqDTO {

    /**
     * ids
     */
    @NotNull(message = "id cant not null")
    private Long id;

    /**
     * 是否过滤已删除
     */
    @NotNull(message = "filterDeleted cant not null")
    private Boolean filterDeleted;

    /**
     * 是否会话缓存
     */
    @NotNull(message = "cache cant not null")
    private Boolean cache;

    public static FindByIdReqDTO filter(Long id) {
        return new FindByIdReqDTO(id, true, false);
    }

    public static FindByIdReqDTO unFilter(Long id) {
        return new FindByIdReqDTO(id, false, false);
    }

    public static FindByIdReqDTO filterCache(Long id) {
        return new FindByIdReqDTO(id, true, true);
    }

    public static FindByIdReqDTO unFilterCache(Long id) {
        return new FindByIdReqDTO(id, false, true);
    }

    public static FindByIdReqDTO build(Long id, boolean filterDeleted) {
        return new FindByIdReqDTO(id, true, false);
    }

    public static FindByIdReqDTO buildCache(Long id, boolean filterDeleted) {
        return new FindByIdReqDTO(id, true, true);
    }
}
